﻿using UnityEngine;
using System.Collections;
using Dict.Config;
using Dict.Blo;
using Dict.DataModel;

namespace UI
{
    public class UnionIcon : MonoBehaviour
    {
        public TextureKit unionIcon;
        public GameObject chosedBg;

        public delegate void OnIconClick(string id);
        public OnIconClick m_callback;
        
        string unionIconId;
        public string UnionIconId
        {
            get
            {
                return unionIconId; 
            }
        }

        public void SetUnionIcon(string id)
        {
            unionIconId = id;
			TableUnionLogo unionIcons=Dict.Blo.DictUnionLogoBlo.GetUnionLogo(id); 
            if(unionIcons == null)
            {
                return;
            }
            
            unionIcon.iconType = TextureIcon.UNIONLOGO;
            unionIcon.textureName = unionIcons.iconName;
        }
        public void OnClick()
        {
            if (m_callback != null)
                m_callback(unionIconId);
        }
    }

}